<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/6
 * Time: 10:15
 */
?>
<!!DOCTYPE html>
<html>
	<style type="text/css">
		#div1 {
			width: 100%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		#div1_login {
			width: 400px;
			height: 250px;
			background-color: bisque;
			display: flex;
			justify-content: center;
		}

		#div1_login_submit {
			display: flex;
			justify-content: center;
		}

		#btn_submit {
			width: 175px;
			height: 36px;
			background-color: #FE7300;
		}

		.input_style {
			width: 200px;
			height: 30px;
		}

		.style1 {
			position: relative;

		}
	</style>
	<head>
		<div id="div1">
			<div id="div1_login">
				<form action="login_get_cookies.php" id="form1" method="post">
					<h1>登录</h1>
					<div id="">
						账号:<input class="input_style" type="text" name="username" id="login1" onchange="username_change()" onclick="clear_text_username()"
						 value="请输入你的账号/手机/邮箱" />
					</div><br />
					<div id="">
						密码:<input class="input_style" type="password" name="pwd" id="login2" value="" />
					</div><br />
					<div id="div1_login_submit" class="style1">
						<input id="btn_submit" type="submit" value="登录" onclick="login()" />
					</div>
				</form>
			</div>
		</div>
	</head>
	<script type="text/javascript">
		function clear_text_username() {
			if (document.getElementById('login1').value == '请输入你的账号/手机/邮箱') {
				document.getElementById('login1').value = '';
			}
		}

		function username_change() {
			if (document.getElementById('login1').value == '') {
				document.getElementById('login1').value = '请输入你的账号/手机/邮箱';
			}
		}

		function login() {
			var username = document.getElementById('login1').value;
			var pwd = document.getElementById('login2').value;
			if (username == 'admin' && pwd == '888888') {
				alert('登陆成功！');
				window.location.href = "login_cookies.php";
			} else {
				alert('账号或密码错误！');
				document.getElementById('form1').action = '';
			}
		}
	</script>
</html>
